﻿namespace exnet.Explorer
{
    public class Drive : System.Collections.ObjectModel.ObservableCollection<Folder>
    {
        private string _driveLetter = "";
        public Drive(string driveLetter) 
        { 
            _driveLetter = driveLetter;

            // populate folders
            System.IO.DriveInfo driveInfo = new System.IO.DriveInfo(_driveLetter);
            if (driveInfo.IsReady)
            {
                System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(driveInfo.RootDirectory.FullName);
                foreach (System.IO.DirectoryInfo di in dirInfo.GetDirectories())
                {
                    Add(new Folder(di.FullName));
                }
            }
        }

        public string Name { get { return _driveLetter; } }
    }
}
